//
//  Persion.m
//  TestObjc
//
//  Created by wp w on 12-6-12.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "Person.h"

@implementation Person
@synthesize pid;
@synthesize name;
@synthesize height;

+(Person *)personWithPid:(int)pid Name:(NSString *)name Height:(float)height{
    Person *persion = [[Person alloc]init];
    persion.pid = pid;
    persion.name = name;
    persion.height = height;
    return persion;
}

-(Person *)initWithPid:(int)aPid Name:(NSString *)aName Height:(float)aHeight{
    self = [super init];
    if (self) {
        pid = aPid;
        [aName retain];
        [name release];
        name = aName;
        height = aHeight;
    }
    return self;   
}

-(void) dealloc{
    [name release];
    [super dealloc]; 
}

-(NSString *)description{
    NSMutableString *mstr = [[[NSMutableString alloc] init] autorelease];
    [mstr appendFormat:@"{%d,%@,%.1f}", pid, name, height];
    return mstr;
}

-(void) print: (NSString*) str{ 
    NSLog(@"%@ %@",str,name);
}

@end
